package cn.dust.design.pattern.behavioral.visitor;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: dust
 * @Date: 2019/11/28 19:30
 */
public class Test {

    public static void main(String[] args) {
        List<Course>courseList=new ArrayList<Course>();
        FreeCourse freeCourse=new FreeCourse();
        freeCourse.setName("Java");

        CodingCourse codingCourse=new CodingCourse();
        codingCourse.setName("风女");
        codingCourse.setPrice(998);

        courseList.add(freeCourse);
        courseList.add(codingCourse);

        for(Course course:courseList){
            course.accept(new Visitor());
        }
    }
}
